package com.hand.springbootdemo.controller;

import com.fasterxml.jackson.databind.ObjectMapper;
import com.hand.springbootdemo.domain.entity.Student;
import com.hand.springbootdemo.domain.mapper.StudentMapper;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import javax.annotation.Resource;
import java.util.List;

@Controller
public class ViewController {
    @Resource
    private StudentMapper studentMapper;

    @RequestMapping("/")
    public ModelAndView index() {
        ModelAndView mv = new ModelAndView();
//        List<Student> students = studentMapper.selectAll();
//        mv.addObject("students", students);
//        // json 工具
//        ObjectMapper objectMapper = new ObjectMapper();
//        mv.addObject("json", objectMapper);
        mv.setViewName("index");
        return mv;
    }
}
